home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
aie8911.zip
/
LISTING.4
< prev
next >
Wrap
Text File
|
1989-08-27
|
1KB
|
55 lines
Listing 4
LOOP EXECUTION
do_a_loop( Frame) :-
% get rid of old definitions
abolish( zzz_loop / 0),
abolish( zzz_loop_hlpr / 0),
% get purpose of procedure defined in stub
frame_slot_val( purpose, Frame, Purpose),
% get purpose in past form
done_it_prompt( Purpose , Done ),
% get prompt to ask for repeating loop
another_prompt( Purpose , More ),
% define question to ask user
Question =
yes( log_write( More ) ,
q_means_no,
do_quit ) ,
% define the simulated loop
Loop_rule1 =
(zzz_loop :-
repeat,
zzz_loop_hlpr),
assertz( Loop_rule1 ),
Loop_rule2 = zzz_loop,
assertz( Loop_rule2 ),
% and the helper functions for the loop
Loop_hlpr_rule1 =
( zzz_loop_hlpr :-
Question,
!,
log_write( Done),
log_nl,
fail),
assertz( Loop_hlpr_rule1 ),
Loop_hlpr_rule2 =
( zzz_loop_hlpr :- ! ),
assertz( Loop_hlpr_rule2 ),
% now execute the loop
call( zzz_loop ).
---------------- end of listing -----------------------------------